Craig A. Sloss

Blog

Picture of a notebook

Filters added to Election Dashboard

2016-07-21

I've added the ability to apply filters to the Election Dashboard. Filters can be used to remove data from the analysis entirely, in contrast to dimensions, which keep the data in the analysis but subdivide it prior to analysis. Currently, five filters are available:

Each of the filters can be toggled on or off independently, so for example, you could restrict to incumbents of the Big Five, or look at incumbents who were re-elected. Be careful with the selection of filters, because some combinations (e.g. "only incumbents" and "only non-incumbents") could result in an empty report.

Filters may be used either as a supplement to a dimension, or as a replacement for one. For example, if one of your dimensions was political party, there may be value in applying the "Big Five" filter in order to produce a smaller report. (In fact, this filter is now on by default.) On the other hand, if you were only interested in looking at incumbent data, one solution could be to use incumbency as one of the dimensions and just ignore the non-incumbent parts of the report. A better solution would be to apply the incumbent filter, which would free up one of the dimensions to be used for another variable.

In addition to adding filters, I've made some cosmetic changes to improve the appearance of the report, and added a new metric, Number of Candidates. Because I removed candidate name from the data in order to conserve space, this metric is calculated by counting unique pairs of district number and political party. In most cases, this will work well (since a party only runs one candidate per riding), but may not be accurate for independent candidates.

Keywords: Election Dashboard

Link to this post

Election Dashboard Now Available

2016-07-20

I've recently added a new section to the website, called the Election Dashboard. This page allows you to produce a variety of summary reports based on data from the 2011 Canadian Federal Election. This is a preliminary version that has only basic functionality; over time, I'm planning on adding more features to the dashboard, joining additional data sources, and expanding to the 2015 election.

How to use the dashboard

To use the dashboard, you select the metric you want to calculate, and two dimensions that will be used to group the data prior to calculation of the metric. The primary dimension will form the rows of the report, and the secondary dimension will provide the columns. Dimensions available include:

The two metrics available are the total number of votes cast, and the conversion ratio, which is defined as the total number of votes cast divided by the number of voters who were eligible to vote for that candidate.

Summarization of Conversion Ratio Calculations

Because the metrics are being calculated on data that is grouped according to the dimensions, it is important to clarify how the conversion ratio is calculated. Both the number of votes cast and the number of eligible voters are totalled before the ratio is calculated. For some dimensions, voters may be counted multiple times if their vote is courted by multiple political parties within in the grouping. A typical example of this would be when the "Elected Candidate" dimension is used: in the "N" column, because there are many non-elected candidates in each riding, this is a grouping in which multiple candidates are vying for each elector's vote. The "Y" grouping does not present this problem, since there is a unique winning candidate in each riding. In general, the conversion ratio should be interpreted as the weighted average conversion ratio of all candidates in the grouping defined by the dimensions. The main advantage of this approach to calculating conversion ratio is that it allows for fair conversion ratio comparisons between political parties based on the number of ridings they actually contested; this is a particularly relevant consideration for parties such as the Bloc Québécois which only runs candidates in Quebec.

Data Sources, Processing, and Reconciliation

Election results were obtained from the Elections Canada Website; "Format 2" as described on this site was used. Data was processed using R. Filters and transformations applied include:

Following data processing, top-level reconciliation was performed to validate that the total number of votes cast (14,723,980), the total number of eligible voters (24,257,592), and number of electoral districts (308) match the values reported by Elections Canada. More granular reconcilitaion (e.g. at the party and province level) can be performed using the dashboard itself, and match the results provided in "Table 8" of the Elections Canada report on the 2011 election.

Keywords: Website news, Election Dashboard

Link to this post

Navigation

Mastodon